public class SZtoString {
    public static void main(String[] args) {
        int[] array = {1,2,3,4};
        String ret = myToString(array);
        System.out.println(ret);
    }

    public static String myToString(int[] array) {
      //  assert array != null;
        if (array == null) {
            return "null";
        }
        String ret = "[";
        for (int i = 0; i < array.length; i++) {
            ret += array[i];
            if (i != array.length - 1) {
                ret += ",";
            }
        }
        ret += "]";
        return ret;
    }
}

